package cn.tedu.basic;

import java.util.Scanner;

//测试  正则表达式
public class Regex {
    public static void main(String[] args) {
        //接收用户输入的手机号码，判断格式是否正确
        String tell =new Scanner(System.in).nextLine();
        String regex ="[1][0-9]{10}";//语法格式
        //规定一个Regex规则--String.Matches(regex)
        if (tell.matches(regex)){//判断是否复合格式
            System.out.println("reght");
        }else{
            System.out.println("wrong");
        }
        //测试身份证号码
        String score =new Scanner(System.in).nextLine();
        String regex1 ="[0-9]{17}[0-9X]";
        if (score.matches(regex1)){
            System.out.println("right");
        }else {
            System.out.println("wrong");
        }
        //测试档案编码
        String num =new Scanner(System.in).nextLine();
        String regex2="[A-Z]{5}[0-9]{6}";
        if (num.matches(regex2)){
            System.out.println("right");
        }else {
            System.out.println("wrong");
        }
        //测试信用编码
        String sum =new Scanner(System.in).nextLine();
        String regex3="[A-Z]{6}[0-9]{5}[A-Z]{4}";
        if (sum.matches(regex3)){
            System.out.println("right");
        }else{
            System.out.println("wrong");
        }
    }
}
